<?php


namespace App\Http\Controllers\Api;
use App\Models\User;
use Illuminate\Http\Request;

class UserController extends BaseController
{

    public function store(Request $request) {
        $this->_check();
        $this->validate($request, [
            'role' => 'required|in:1,2,3',
            'title' => 'required',
            'phone' => 'required',
        ]);
        $user = $this->getUser();
        $input = $request->input();
        User::where('id', $user->id)->update($input);
        $cache_key = $user->getMorphClass() . ":" . $user->id;
        \Cache::forget($cache_key);
        return $this->success("注册成功", ['id' => $user->id]);
    }

}

